/****************************************************************************
	This file is part of Basqet.

	Basqet is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	Basqet is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
    along with Basqet.  If not, see <http://www.gnu.org/licenses/>.

****************************************************************************/

#include "noteobjecttoolbar.h"

#include "tagmanager.h"

NoteObjectToolBar::NoteObjectToolBar(QWidget * parent /*= 0*/)
		:QToolBar("Note Tools", parent),
		pTagManager(new TagManager())
{
	populate();

}

void NoteObjectToolBar::populate()
{
	pDelete = new QAction(QIcon(":/actions/edit-delete.png"), "Delete Note", this);
	addAction(pDelete.data());
	connect(pDelete.data(), SIGNAL(triggered()), this, SIGNAL(actionDelete()));

	pNoteLable = new QAction("Labels", this);
	pNoteLable->setMenu(pTagManager->getTagMenu());
	addAction(pNoteLable.data());

	connect(pTagManager.data(), SIGNAL(tagSelected(QString,QIcon)), this, SIGNAL(actionSetLable(QString,QIcon)));


	disableActions();

}

void NoteObjectToolBar::enableActions()
{
	setActionsEnabled(true);
}

void NoteObjectToolBar::disableActions()
{
	setActionsEnabled(false);
}

void NoteObjectToolBar::setActionsEnabled(bool enabled)
{

	pDelete->setEnabled(enabled);
	pNoteLable->setEnabled(enabled);

}


void NoteObjectToolBar::enableTaging()
{
	setTagingEnabled(true);
}

void NoteObjectToolBar::disableTaging()
{
	setTagingEnabled(false);
}

void NoteObjectToolBar::setTagingEnabled(bool enabled)
{

	pNoteLable->setEnabled(enabled);

}



void NoteObjectToolBar::enableDeletion()
{
	setDeletionEnabled(true);
}

void NoteObjectToolBar::disableDeletion()
{
	setDeletionEnabled(false);
}

void NoteObjectToolBar::setDeletionEnabled(bool enabled)
{

	pDelete->setEnabled(enabled);

}
